<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的评论 | {$site_name}</title>
    <include file="user:include"/>
</head>
<body>

<div class="layui-layout layui-layout-admin">
    <include file="user:header"/>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <include file="user:userNav"/>
        </div>
    </div>

    <div class="layui-body">

        <!-- 内容主体区域 -->
        <div id="content">
            <div class="layui-card layui-comment">
                <!-- // 默认操作按钮 -->
                <div class="layui-card-header layadmin-card-header-auto ">
                    <div class="layui-form">
                        <div class="layui-form-item">

                            <div class="layui-inline">
                                <div class="layui-input-inline ">
                                    <input name="keyword" class="layui-input" type="text"
                                           placeholder="{:__('关键字搜索')}"/></div>
                            </div>

                            <div class="layui-inline">
                                <!-- // 默认搜索 -->
                                <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i
                                        class="layui-icon layui-icon-search"></i>{:__('搜索')}
                                </button>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- // 创建数据实例 -->
                <table id="lay-tableList" lay-filter="lay-tableList"></table>
            </div>
        </div>

    </div>

    <include file="user:footer"/>
</div>

<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" lay-open lay-title="{:__('编辑评论')}" lay-area="650px,395px"
       lay-url="/user/commentedit?id={{d.id}}" lay-event="reply">{:__('编辑')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" onclick="layer.msg('暂不支持删除','info')" lay-event="del">{:__('删除')}</a>
</script>

</body>
</html>

<script>
    layui.use(['table'], function () {

        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url('/user/comment')}"
            , page: true
            , limit: 18
            , cols: [[
                {type: 'checkbox', width: 45},
                {field: 'id', align: 'center', sort: true, width: 80, title: 'ID'},
                {field: 'content', align: 'left', title: '{:__("评论内容")}'},
                {field: 'count', align: 'center', width: 120, title: '{:__("回复")}'},
                {field: 'ip', align: 'center', width: 160, title: '{:__("登录IP")}'},
                {
                    field: 'createtime',
                    align: 'center',
                    width: 160,
                    templet: '<div>{{ layui.util.toDateString(d.createtime*1000, "yyyy-MM-dd HH:mm:ss") }}</div>',
                    title: '{:__("评论时间")}'
                },
                {align: 'center', toolbar: '#tableBar', width: 160, title: '{:__("操作")}'},
            ]]
        })

    })
</script>